<template>
  <div class="container flex column">
    <div class="title flex shrink">
      <span class="bhead icon">
        {{ content }}
      </span>
    </div>
    <nav class="nav flex">
      <div
        class="tab-item"
        :class="{ active: active == index }"
        v-for="(item, index) in routeList"
        :key="index"
      >
        <div @click="toRoute(item.link, index)">
          {{ item.name }}
          <div :class="{ line: active == index }"></div>
        </div>
      </div>
    </nav>
    <div class="rightBox flex column">
      <Msg v-if="active == 0"></Msg>
      <Choiceness v-if="active == 1"></Choiceness>
      <Notice v-if="active == 2"></Notice>
    </div>
  </div>
</template>
<script>
import Choiceness from "./choiceness";
import Msg from "./msg";
import Notice from "./notice";
import { getRoom } from "../api/index";
import { getUrlParams } from "../script/utils";
const { token, productId, userId } = getUrlParams();

export default {
  data() {
    return {
      active: 0,
      content: "",
      routeList: [{ name: "私信" }, { name: "精选" }, { name: "公告" }],
    };
  },
  components: { Choiceness, Msg, Notice },
  mounted() {
    this.getRoom();
  },

  methods: {
    toRoute(path, index) {
      // this.$emit("submit", index);
      this.active = index;
    },
    async getRoom() {
      //根据产品id查询直播室信息
      // const { status, data } =
      await getRoom({ productId: productId }).then((back) => {
        if (back.status == 1) {
          let data = back.data;
          console.log("info", data);
          if (status == 1 || data != undefined) {
            this.content = data.content;
          }
        }
      });
    },
  },
};
</script>
<style lang="scss" scoped>
.container {
  width: 450px;
  height: 100%;
  border-radius: 8px;
  border: 1px solid rgba(69, 72, 85, 0.8);
  background: rgba(13, 18, 30, 0.8);
}
.title {
  height: 146px;
  align-items: center;
  font-weight: 400;
  background: #262831;
  border-radius: 8px 0 0 0;
  .bhead {
    display: inline-block;
    height: 146px;
    line-height: 20px;
    font-size: 14px;
    padding: 15px 15px 17px 129px;
    box-sizing: border-box;
    color: #bcbfc4;
    overflow-y: auto;
    &.icon {
      background: url($PIC_URL + "/tlbypcWeb/extremeLive/pic.png") no-repeat
        left center;
    }
  }
}
.nav {
  width: 100%;
  height: 40px;
  justify-content: center;
  z-index: 2;
  .tab-item {
    box-sizing: border-box;
    width: 150px;
    height: 40px;
    font-size: 16px;
    color: #bcbfc4;
    text-align: center;
    background: #262831;
    line-height: 40px;
    border: 1px solid #383a45;
    &.active {
      color: #fff;
      background: #35497c;
    }
  }
}
.rightBox {
  overflow: hidden;
  height: 100%;
}
</style>
